#!/usr/bin/perl
#createmod.cgi

require './netfilter-lib.pl';
&ReadParse();
&header($text{'createtitle'}, "" , "index", 0, 1,);

print "<form name='crmod' action=creating.cgi method=post onsubmit='on_form_sbumit()'>\n";
print "<table class=mode1 width=80%>\n";
print "<input type=hidden name=objtype value=0>";

print "<tr><td><input type=radio name=ipnet checked value='0' onclick='return clickipnet(0); '>$text{'ip'}<input type=radio name=ipnet value='1' onclick='return clickipnet(1)'>$text{'network'}</td><td><i>($text{'needmask'})</i></td></tr>";
print "<tr><td width=150>$text{'ipaddr'}</td><td><input type=text name=ipaddr class=text></td></tr><tr><td width=150>$text{'mask'}</td><td>";
print "<input type=text name=ipaddr2 class=text value='------' disabled=true></td></tr>\n";

#print "<tr><td width=150>$text{'port'}</td><td><input type=text name=port class=text></td></tr>\n";
print "<tr><td width=150>$text{'rule_policy'}</td><td><select name=ruletype>";
print "<option %s value='DROP'>$text{'rule_drop'}";
print "<option %s value='ACCEPT'>$text{'rule_accept'}";
print "</select></td></tr>";

print "<tr><td width=150>$text{'port'}</td><td><select name=ruleport>";
print "<option %s value=''>$text{'port_all'}";
print "<option %s value='137:445'>$text{'port_cifs'}";
print "<option %s value='2049'>$text{'port_nfs'}";
print "<option %s value='21'>$text{'port_ftp'}";
print "<option %s value='80'>$text{'port_http'}";
print "<option %s value='3260'>$text{'port_iscsi'}";
#print "&nbsp;&nbsp;&nbsp;&nbsp;<input name=otherport type=checkbox value=''>$text{'port_other'}";
print "</select></td></tr>";

print "</table>\n";

print "<table border=0 class=mode1><tr><td>\n";
print "<input type=submit name=modify value=\"$text{'bt_add'}\" class=button1 onclick='return on_create_click();'>\n";
print "<input type=submit name=cancle value=\"$text{'bt_cancel'}\" class=button1 onclick='return on_cancle_click()'>\n";
print "</td></tr></table>\n";
print <<EOF;
<script>
function clickipnet(type)
{
	if (type == 0) {
		document.crmod.ipaddr2.disabled=true;
		document.crmod.ipaddr2.value="------";
		document.crmod.objtype.value="0";
	}

	if (type == 1) {
		document.crmod.ipaddr2.disabled=false;
		document.crmod.ipaddr2.value="";
		document.crmod.objtype.value="1";
	}
}

function on_create_click()
{   

}

function on_cancle_click()
{
    document.crmod.action = "cancle.cgi";
}
</script>
EOF
&footer("index.cgi", $text{'index'});
